def is_valid_bracket_sequence(sequence):
    stack = []
    bracket_pairs = {'(': ')', '[': ']', '{': '}', '<': '>'}

    for bracket in sequence:
        if bracket in bracket_pairs.keys():
            stack.append(bracket)
        elif bracket in bracket_pairs.values():
            if not stack or bracket_pairs[stack.pop()] != bracket:
                return False

    return not stack

input_sequence = input("Введите скобочную последовательность: ")
result = is_valid_bracket_sequence(input_sequence)
print(result)
